
//
//  DiscoverMCircleDetailViewController.m
//  HAODE
//
//  Created by panquanReabam.com on 15/9/14.
//  Copyright (c) 2015年 reabam.com. All rights reserved.
//
#import "DiscoverBusinessDetailViewController.h"
#import "RDVTabBarController.h"
#import "RepairCell.h"
#import "Repairmodel.h"
#import "UIImageView+WebCache.h"

#import "HttpRequest.h"
#import "TheLoginViewController.h"
#import "HAODEsingleton.h"
#import "addRepairViewController.h"
#import "imageview.h"
#import "addRepairViewController.h"
#import "UIButton+WebCache.h"
#import "MCircleCell.h"
#import "KeyboardModel.h"
#import "UMSocial.h"
#import "DiscoverBusinessCommentsViewController.h"
#import "SelectTheCertificationViewController.h"
@interface DiscoverBusinessDetailViewController ()<UIScrollViewDelegate,UIGestureRecognizerDelegate,UINavigationControllerDelegate,UITableViewDataSource,UITableViewDelegate,UITextViewDelegate,UIWebViewDelegate,KeyboardModelDelegate,UMSocialUIDelegate>

@property (nonatomic, strong) UIImageView * allImageBtn;
@property(nonatomic,strong)NSString*sta;
@property(nonatomic,strong)   NSString*shuoming;
@property(nonatomic,strong)   NSString*shareUrl;
@end

@implementation DiscoverBusinessDetailViewController{
    int index;
    NSString * hasNext;
    NSString *nextIndex;
    NSMutableArray *allComment;
    NSMutableArray *amt;
    NSMutableArray *detail;
    NSMutableArray *provinceName;
    NSMutableArray *cityName;
    NSMutableArray *status;
    NSMutableArray*imageUrlFull;
    NSMutableArray *time;
    NSMutableArray *reqId;
    NSMutableArray *address;
    NSMutableArray *userName;
    HAODEsingleton*commdity;
    UIButton*sat;
    UIButton*sat1;
    UIButton*sxuan;
    int tapImageCount;
    UIScrollView*MYmainScroll;
    NSMutableArray*arr;
    imageview*imageView;
    UIView*view;
    UIButton*i22;
    UIButton*i1;
    UIButton*i12;
    NSMutableArray *cDate;
    NSMutableArray *content;
    NSMutableArray *headImage;
    UITextView*tv;
    UIImageView*imagess;
    UILabel*label;
    UIWebView*webview;
    UIView*fengxiangview;
    UIButton* quxiao;
    UIScrollView*fengxiangScroll;
    NSDictionary*dataDicts;
}
@synthesize alt = alt;
- (void)viewDidDisappear:(BOOL)animated

{
    
    [super viewDidDisappear:animated];
    
    
    
    self.navigationController.delegate = nil;
    
}
-(void)BackAction:(UIButton *)sender{
    
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    
    self.navigationController.delegate = self;
    
    self.navigationController.interactivePopGestureRecognizer.delegate = self;
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@""] forBarMetrics:UIBarMetricsDefault];
    self.navigationController.navigationBar.shadowImage =[[UIImage alloc] init];
    
    [[self rdv_tabBarController] setTabBarHidden:YES];
    self.navigationController.navigationBarHidden = NO;
 
    
    UIImage* backImage = [UIImage imageNamed:@"fanhui"];
    CGRect backframe = CGRectMake(0,0,30,30);
    UIButton* backButton= [[UIButton alloc] initWithFrame:backframe];
    [backButton setBackgroundImage:backImage forState:UIControlStateNormal];
    backButton.titleLabel.textAlignment=NSTextAlignmentLeft;
    [backButton addTarget:self action:@selector(BackAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    self.navigationItem.leftBarButtonItem = leftBarButtonItem;
    UIButton* sxBtn = [[UIButton alloc] initWithFrame:CGRectMake(30, 0.0,  60/2, 60/2)];
    [sxBtn setImage:[UIImage imageNamed:@"fenxiang"] forState:UIControlStateNormal];
    [sxBtn addTarget:self action:@selector(fenxiangss:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem* myBtnBtn = [[UIBarButtonItem alloc] initWithCustomView:sxBtn];
    self.navigationItem.rightBarButtonItem = myBtnBtn;

    [self setup];
    
}
-(void)closeKeyBoad
{
    [fengxiangview removeFromSuperview];
    [fengxiangScroll removeFromSuperview];
    [quxiao removeFromSuperview];
    
}
-(void)fenxiangss:(UIButton*)sender{
    
    
    NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
    NSString* Token = [user objectForKey:@"tokenId"];
    if (Token ==nil) {
        Token=@"dd";
    }
    NSMutableDictionary *param = [NSMutableDictionary new];
    [param setValue:Token forKey:@"tokenId"];
    [param setValue:@"Business" forKey:@"contentType"];
    [param setValue:commdity.reqId forKey:@"contentId"];
    //    [param setValue:@"wx_single" forKey:@"shareTarget"];
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:30 view:self.view];
    
    
    [HttpRequest requestData:@"Discover/getShareUrl" params:param success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"====%@",severDataDict.dataDict);
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                
                self.shuoming=[severDataDict.dataDict objectForKey:@"shareDescription"];
                self.shareUrl=[severDataDict.dataDict objectForKey:@"shareUrl"];
                
                fengxiangview=[[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
                fengxiangview.backgroundColor=[UIColor blackColor];
                fengxiangview.alpha=0.5;
                [self.view addSubview:fengxiangview];
                
                fengxiangScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0,ScreenHeight-240, ScreenWidth,200)];
                fengxiangScroll.delegate = self;
                fengxiangScroll.userInteractionEnabled = YES;
                fengxiangScroll.scrollEnabled = YES;
                fengxiangScroll.showsVerticalScrollIndicator = FALSE;
                fengxiangScroll.showsHorizontalScrollIndicator = FALSE;
                fengxiangScroll.backgroundColor=[UIColor whiteColor];
                [self .view addSubview:fengxiangScroll];
                
                // 手势
                UITapGestureRecognizer *singleFingerOne = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyBoad)];
                singleFingerOne.numberOfTouchesRequired = 1; //手指数
                singleFingerOne.numberOfTapsRequired = 1; //tap次数
                singleFingerOne.delegate = self;
                [fengxiangview addGestureRecognizer:singleFingerOne];
                
                
                
                
                NSArray*nameBtn=[[NSArray alloc]initWithObjects:@"发送給朋友",@"分享到朋友圈",nil];
                NSArray *arrayimage = @[@"faweixin",@"fenxiangpenyouquan"];
                for (int i = 0; i<2; i++) {
                    UIButton *nameButcenter = [[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth/3*i,   80*ScreenHeight/1334+15, ScreenWidth/3, 60)];
                    
                    [fengxiangScroll addSubview:nameButcenter];
                    
                    
                    UIButton *nameBut = [[UIButton alloc]initWithFrame:CGRectMake(ScreenWidth/3*i,   nameButcenter.bottom+20, ScreenWidth/3, 14)];
                    [nameBut setTitle: [nameBtn objectAtIndex:i]  forState:UIControlStateNormal];
                    nameBut.tag=201+i;
                    [nameBut setTitleColor:shenhuicolor forState:0];
                    nameBut.titleLabel.font=[UIFont systemFontOfSize:14];
                    [nameBut addTarget:self action:@selector(fengxiang:) forControlEvents:UIControlEventTouchUpInside];
                    [fengxiangScroll addSubview:nameBut];
                    
                    
                    UIButton *wuyebuttonimage = [UIButton buttonWithType:UIButtonTypeCustom];
                    wuyebuttonimage.frame = CGRectMake(ScreenWidth/3*i,  10, 60, 60);
                    
                    wuyebuttonimage.tag = 201+i;
                    wuyebuttonimage.center=nameButcenter.center;
                    [wuyebuttonimage setImage:[UIImage imageNamed: [arrayimage objectAtIndex:i]] forState:UIControlStateNormal];
                    [wuyebuttonimage addTarget:self action:@selector(fengxiang:) forControlEvents:UIControlEventTouchUpInside];
                    [fengxiangScroll addSubview:wuyebuttonimage];
                    
                    
                }
                
                
                quxiao = [[UIButton alloc] initWithFrame:CGRectMake(0,ScreenHeight-45,  ScreenWidth, 45)];
                [quxiao setTitle:@"取消" forState:UIControlStateNormal];
                quxiao.titleLabel.font=[UIFont systemFontOfSize:16];
                quxiao.backgroundColor=[UIColor whiteColor];
                [quxiao setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
                [quxiao addTarget:self action:@selector(closeKeyBoad) forControlEvents:UIControlEventTouchUpInside];
                [self .view addSubview:quxiao];
                UILabel*line=[[UILabel alloc]initWithFrame:CGRectMake(15, 0, ScreenWidth-30, 0.35)];
                line.backgroundColor=qianhuicolor;
                [quxiao addSubview:line];
                
                
                
            }else{
                [Global hideProgressHUDInternal:self.view];
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==8888) {
                    
                    
                    SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                    
                    [self.navigationController pushViewController:Login animated:YES];
                    
                }
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==4444) {
                    [self showAlertMessage:@"账号信息未认证通过，请从新上传"];
                    
                    SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                    
                    [self.navigationController pushViewController:Login animated:YES];
                    
                }

            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
}

-(void)fengxiang:(UIButton*)sender{
    [fengxiangview removeFromSuperview];
    [fengxiangScroll removeFromSuperview];
    [quxiao removeFromSuperview];
    NSURL *url = [NSURL URLWithString:commdity.ImageUrl];
    NSData *data = [NSData dataWithContentsOfURL:url];
    UIImage *image1 = [[UIImage alloc] initWithData:data];
    if (sender.tag==201) {
        if (![commdity.content isEqualToString:@""]) {
            self.shuoming=commdity.content;
        }
        [UMSocialData defaultData].extConfig.wechatSessionData.title =commdity.title;
        UMSocialUrlResource *urlResource = [[UMSocialUrlResource alloc] initWithSnsResourceType:UMSocialUrlResourceTypeDefault url:self.shareUrl];
        
        [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession].snsClickHandler(self,[UMSocialControllerService defaultControllerService],YES);
        [UMSocialData defaultData].extConfig.wechatSessionData.url = self.shareUrl;
        [[UMSocialDataService defaultDataService]postSNSWithTypes:@[UMShareToWechatSession] content:self.shuoming image:image1 location:nil urlResource:urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
            
            if (response.responseCode == UMSResponseCodeSuccess) {
                NSLog(@"分享成功！");
            }
            
        }];
        
        
        
        
        
        
    }
    
    if (sender.tag==202) {
        
        //         [UMSocialData defaultData].extConfig.wechatSessionData.title =[commdity.Dict objectForKey:@"itemName"];
        UMSocialUrlResource *urlResource = [[UMSocialUrlResource alloc] initWithSnsResourceType:UMSocialUrlResourceTypeDefault url:self.shareUrl];
        [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatTimeline].snsClickHandler(self,[UMSocialControllerService defaultControllerService],YES);
        [UMSocialData defaultData].extConfig.wechatTimelineData.url = self.shareUrl;
        [[UMSocialDataService defaultDataService]  postSNSWithTypes:@[UMShareToWechatTimeline] content:[NSString stringWithFormat:@"%@",    commdity.title] image:image1 location:nil urlResource:urlResource presentedController:self completion:^(UMSocialResponseEntity *response){
            if (response.responseCode == UMSResponseCodeSuccess) {
                NSLog(@"分享成功！");
            }
        }];
        
        
        
        
    }
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"";
    commdity=[HAODEsingleton shared];
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                     backColor,
                                                                     UITextAttributeTextColor,
                                                                     [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:1],
                                                                     UITextAttributeTextShadowColor,
                                                                     [NSValue valueWithUIOffset:UIOffsetMake(0, 0)],
                                                                     UITextAttributeTextShadowOffset,
                                                                     [UIFont fontWithName:@"Helvetica Neue" size:tetlefot],
                                                                     UITextAttributeFont,nil]];
    
    
    
    
    
}

- (void)setup{
    
    content=[[NSMutableArray alloc]init];
    userName=[[NSMutableArray alloc]init];
    headImage=[[NSMutableArray alloc]init];
    cDate=[[NSMutableArray alloc]init];
    
    NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
    NSString* tokenId = [user1 objectForKey:@"tokenId"];
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setValue:tokenId forKey:@"tokenId"];
    [params setValue:commdity.reqId forKey:@"infoId"];
    
    NSLog(@"-----%@",params);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:20 view:self.view];
    [HttpRequest requestData:@"/Discover/Business/Detail" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            
            NSLog(@"-----%@",severDataDict.dataDict);
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                [Global hideProgressHUDInternal:self.view];
                commdity.Dict=severDataDict.dataDict;
                [webview removeFromSuperview];
                webview  = [[UIWebView   alloc]  initWithFrame:CGRectMake( 0, 64,  ScreenWidth ,  ScreenHeight)];
                webview.scalesPageToFit = TRUE;
                [webview   setUserInteractionEnabled: YES ];	 //是否支持交互
                [webview   setDelegate: self ];				 //委托
                [webview   setOpaque: YES ];
                webview.backgroundColor=[UIColor whiteColor];//透明//透明//透明
                [self.view  addSubview : webview];
                
                NSString * path =[NSString stringWithFormat:@"%@",[severDataDict.dataDict objectForKey:@"infoPage"]];
                ;
                [webview loadRequest:[NSURLRequest requestWithURL:[[NSURL alloc] initWithString :path]]];

                [[KeyboardModelboard customKeyboard]textViewShowView:self String1:[severDataDict.dataDict objectForKey:@"isCollect"] pinglunshuString1 :[[severDataDict.dataDict objectForKey:@"businessInfo"]objectForKey:@"commentCount"]   customKeyboardDelegate:self];
                
                
            }else{
                
                
                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                [Global showTextHudSub:requestResultStr view:self.view];
                
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==9999) {
                    
                    TheLoginViewController*detailViewController = [[TheLoginViewController alloc] init];
                    
                    [self.navigationController pushViewController:detailViewController animated:YES];
                    
                }
                
            }
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
}
-(void)pinglunBtn:(UITextField *)textViewGet
{
    NSLog(@"%@",textViewGet.text);
    
    
    if (textViewGet.text.length==0)
    {
        
        [self showAlertMessage:@"内容为空"];
    }else{
        if ([textViewGet.text isEqualToString:@"我来说两句..."])
        {
            
            [self showAlertMessage:@"内容为空"];
        }else{
            
            
            NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
            NSString* tokenId = [user1 objectForKey:@"tokenId"];
            NSMutableDictionary *params = [NSMutableDictionary new];
            [params setValue:tokenId forKey:@"tokenId"];
            [params setValue:commdity.reqId forKey:@"infoId"];
            [params setValue:textViewGet.text forKey:@"content"];
            NSLog(@"-----%@",params);
            [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:10 view:self.view];
            [HttpRequest requestData:@"/Discover/Business/AddComment" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
                if (isSuccess) {
                    [Global hideProgressHUDInternal:self.view];
                    NSLog(@"-----%@",severDataDict.dataDict);
                    textViewGet.text=@"";
                    if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                        
                        
                        DiscoverBusinessCommentsViewController*detailViewController = [[DiscoverBusinessCommentsViewController alloc] init];
                        
                        [self.navigationController pushViewController:detailViewController animated:YES];
                        
                        
                        
                        
                        
                    }else{
                        
                        
                        NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
                        [Global showTextHudSub:requestResultStr view:self.view];
                        if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==8888) {
                            
                            
                            SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                            
                            [self.navigationController pushViewController:Login animated:YES];
                            
                        }
                        if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==4444) {
                            [self showAlertMessage:@"账号信息未认证通过，请从新上传"];
                            
                            SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                            
                            [self.navigationController pushViewController:Login animated:YES];
                            
                        }

                        
                    }
                    
                    
                }
                else
                {
                    [Global hideProgressHUDInternal:self.view];
                    
                    [Global showTextHudSub:@"连接失败" view:self.view];
                }
                
            }];
            
            
            
        }
        
    }
    
    
    
    
}
-(void)pinglunBtnjiemian:(NSString *)pinglunjiemian{
    
    DiscoverBusinessCommentsViewController*detailViewController = [[DiscoverBusinessCommentsViewController alloc] init];
    
    [self.navigationController pushViewController:detailViewController animated:YES];
    
    
}
-(void)guangzhuBtn:(UIButton *)guanzhu
{
    NSLog(@"%@",guanzhu.titleLabel.text);
    
    
    
    
    NSUserDefaults *user1 = [NSUserDefaults standardUserDefaults];
    NSString* tokenId = [user1 objectForKey:@"tokenId"];
    NSMutableDictionary *params = [NSMutableDictionary new];
    [params setValue:tokenId forKey:@"tokenId"];
    [params setValue:commdity.reqId forKey:@"infoId"];
    
    NSLog(@"-----%@",params);
    [Global showIndeterminateHudSub:@"加载中，请稍后。。。" delay:10 view:self.view];
    [HttpRequest requestData:@"/Discover/Business/Collect" params:params success:^(BOOL isSuccess, SeverData *severDataDict) {
        if (isSuccess) {
            [Global hideProgressHUDInternal:self.view];
            NSLog(@"-----%@",severDataDict.dataDict);
            
            if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==0) {
                
                [[KeyboardModelboard customKeyboard]textViewShowView:self String1:[severDataDict.dataDict objectForKey:@"isCollect"] pinglunshuString1 :[[commdity.Dict objectForKey:@"businessInfo"]objectForKey:@"commentCount"]    customKeyboardDelegate:self];
                
            }else{
                
                  [Global hideProgressHUDInternal:self.view];
//                NSString *requestResultStr=[severDataDict.dataDict objectForKey:@"ResultString"];
//                [Global showTextHudSub:requestResultStr view:self.view];
                
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==8888) {
                    
                    
                    SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                    
                    [self.navigationController pushViewController:Login animated:YES];
                    
                }
                if ([[severDataDict.dataDict objectForKey:@"ResultInt"] integerValue]==4444) {
                    [self showAlertMessage:@"账号信息未认证通过，请从新上传"];
                    
                    SelectTheCertificationViewController * Login=[[SelectTheCertificationViewController alloc]init];
                    
                    [self.navigationController pushViewController:Login animated:YES];
                    
                }

            }
            
            
        }
        else
        {
            [Global hideProgressHUDInternal:self.view];
            
            [Global showTextHudSub:@"连接失败" view:self.view];
        }
        
    }];
    
    
    
    
    
    
    
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [userName count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    
    MCircleCell* cell = (MCircleCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil)
    {
        NSArray* nib = [[NSBundle mainBundle] loadNibNamed:@"MCircleCell" owner:self options:nil];
        cell = [nib objectAtIndex:0];
    }
    UIButton*jiantou = [[UIButton alloc]init];
    jiantou.frame = CGRectMake(0,0, 8, 13);
    [jiantou setImage:[UIImage imageNamed:@"xiangzuo-.png"] forState:UIControlStateNormal];
    
    //    cell.accessoryView = jiantou;
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    cell.image.layer.masksToBounds = YES;
    cell.image.layer.cornerRadius = 40/2;
    [cell.image setImageWithURL:[NSURL URLWithString:[headImage objectAtIndex:indexPath.row]] placeholderImage:[UIImage imageNamed:@""]];
    
    
    
    cell.name.text =[NSString stringWithFormat:@"%@",  [userName objectAtIndex:indexPath.row]];
    NSString *s2 =[content objectAtIndex:indexPath.row];
    UIFont *font2 = [UIFont systemFontOfSize:15];
    CGSize size2 = CGSizeMake(ScreenWidth-40, 2000);
    CGSize labelsize2 = [s2 sizeWithFont:font2 constrainedToSize:size2 lineBreakMode:NSLineBreakByCharWrapping];
    
    commdity.Education=[NSString stringWithFormat:@"%f", labelsize2.height+20];
    cell.content.frame=CGRectMake(60, 50, ScreenWidth-40,labelsize2.height+20);
    cell.content.text =[NSString stringWithFormat:@"%@",  [content objectAtIndex:indexPath.row]];
    
    
    cell.time.text =[NSString stringWithFormat:@"%@",[cDate objectAtIndex:indexPath.row]];
    
    if (userName.count !=indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(15, commdity.Education.intValue+150/3-0.35, ScreenWidth-30, 0.35)];
        lineLabel1.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    if (userName.count ==indexPath.row+1) {
        UILabel *lineLabel1=[[UILabel alloc] initWithFrame:CGRectMake(0, commdity.Education.intValue+150/3-0.35, ScreenWidth, 0.35)];
        lineLabel1.backgroundColor=qianhuicolor;
        [cell.contentView addSubview:lineLabel1];
        
    }
    
    return cell;
}

- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    return commdity.Education.intValue+150/3;
}

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void)showAlertWait
{
    alt = [[UIAlertView alloc] initWithTitle:@"网络不稳定哦 ！" message:@"请确认网络" delegate:self cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
    
}

- (void)showAlertMessage:(NSString *)msg
{
    alt = [[UIAlertView alloc] initWithTitle:@"温馨提示" message:msg delegate:nil cancelButtonTitle:nil otherButtonTitles: nil];
    [alt show];
    
    [self performSelector:@selector(hideAlert) withObject:nil afterDelay:1.0f];
}
- (void)hideAlert
{
    if (alt != nil)
    {
        [alt dismissWithClickedButtonIndex:0 animated:YES];
        alt = nil;
    }
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
